package han.cirno.corrupt.components.cnn

import android.graphics.Bitmap
import han.cirno.larva.image.LarvaImage

object LarvaAndroidUtil {
    fun fromBitmap(bitmap:Bitmap): LarvaImage{
        val width:Int=bitmap.width
        val height:Int=bitmap.height
        val pixels:Array<Array<IntArray>> =Array(1){ Array(width){IntArray(height)} }
        for(i in 0..< width){
            for (j in 0..<height){
                pixels[0][i][j]=bitmap.getPixel(i,j)
            }
        }
        return LarvaImage.fromPixels(pixels)
    }
}